# 超级用户界面
# 密码验证

from PyQt5 import QtWidgets

class super_ui(QtWidgets.QMainWindow):
    def __init__(self):
        super(super_ui, self).__init__()
        self.super_password = 'abcdefg'

    def setupUI(self):
        self.setWindowTitle("超级管理员界面")
        self.setGeometry(100,100,400,100)
        self.Qlable()
        self.Qbutton()
        self.Qlineedie()

    def Qlable(self):
        qlable = QtWidgets.QLabel(self)
        qlable.setText("请输入超级管理员密码:")
        qlable.setGeometry(10,30,130,30)

    def Qlineedie(self):
        self.lineEdit = QtWidgets.QLineEdit(self)
        self.lineEdit.setGeometry(140,30,200,30)
        # 设置密码格式
        self.lineEdit.setEchoMode(QtWidgets.QLineEdit.Password)

    def Qbutton(self):
        pushbutton = QtWidgets.QPushButton(self)
        pushbutton.setText("确定")
        pushbutton.setGeometry(340,30,50,30)
        pushbutton.clicked.connect(self.Qbutton_click)

    def Qbutton_click(self):
        password = self.lineEdit.text()
        password = 'abcdefg'
        if password != self.super_password:
            self.msg = QtWidgets.QMessageBox(QtWidgets.QMessageBox.Warning,"警告","密码输入错误")
            return self.msg.show()
        else:
            self.close()
            from super_main import super_main
            self.s_main = super_main()
            self.s_main.setupUI()
            self.s_main.show()

